(function (doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function () {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                if(clientWidth>=640){
                    docEl.style.fontSize = '100px';
                }else{
                    docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
                }
            };
			
        if (!doc.addEventListener) return;
        recalc();
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);


//var imgList = [];
//var imgurl = '';
//var searchdays = [31,29,31,30,31,30,31,31,30,31,30,31]


//获取当前时间
function getNow(s) {
return s < 10 ? '0' + s: s;
}

/*最大值*/
function max (arr) {
    return Math.max.apply(null, arr);
}

/*最小值*/
function min (arr) {
    return Math.min.apply(null, arr);
}

/*求和*/
function sum (arr) {
    return arr.reduce( (pre, cur) => {
        return pre + cur
    })
}

/*平均值*/
function average (arr) {
    return this.sum(arr)/arr.length
}

/*数组去0*/
function  remove(arr) {
    var arr1 = [];
    for(var i=0;i<arr.length;i++){
        if(arr[i]!='0'){
            arr1.push(arr[i])
        }
    }
    arr = arr1
    return arr
}

function successfn(d){
	console.log(d)
}

//判断血糖时段
function getSugarTimeTypeByHour(){
	var nowDate = new Date();
	var that = this;
	//获取 此时 年月日 数据
	let hour = nowDate.getHours();
	let timeType;
	let timeLimitArray=[6, 10, 11, 14, 18, 20, 22, 3]
 	var timeTypeArray = ['空腹', '早餐后', '午餐前', '午餐后', '晚餐前', '晚餐后', '睡前', '凌晨', '随机']
	let timeLimit6 = timeLimitArray[0]
	let timeLimit10 = timeLimitArray[1]
	let timeLimit11 = timeLimitArray[2]
	let timeLimit14 =timeLimitArray[3]
	let timeLimit18 =timeLimitArray[4]
	let timeLimit20 =timeLimitArray[5]
	let timeLimit22 = timeLimitArray[6]
	let timeLimit3 = timeLimitArray[7]
	if(hour >= timeLimit6 && hour < timeLimit10) { // 空腹
		timeType = 0
	} else if(hour >= timeLimit10 && hour < timeLimit11) { // 早餐后
		timeType = 1
	} else if(hour >= timeLimit11 && hour < timeLimit14) { // 午餐前
		timeType = 2
	} else if(hour >= timeLimit14 && hour < timeLimit18) { // 午餐后
		timeType = 3
	} else if(hour >= timeLimit18 && hour < timeLimit20) { // 晚餐前
		timeType = 4
	} else if(hour >= timeLimit20 && hour < timeLimit22) { // 晚餐后
		timeType = 5
	} else if(hour >= timeLimit22 && hour < timeLimit3) { // 睡前
		timeType = 6
	} else if(hour >= timeLimit3 && hour < timeLimit6) { // 凌晨
		timeType = 7
	} else {
		timeType = 8
	}
//	return timeType;
	console.log('timeType',timeType)
	$('.checkin_upload_top span').text(timeTypeArray[timeType]+'血糖打卡')
}


function is_android_x5_core(){
var u = navigator.userAgent, app = navigator.appVersion; 
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 
if( isAndroid ){
    var isWechatQQ = u.indexOf('MicroMessenger') > -1 || u.indexOf('MQQBrowser') > -1;
    if( isWechatQQ )
      return true
}

return false

}
